<template>
  <div>
    <button @click="add">添加CK</button>
    <button @click="edit">编辑</button>
    <div v-if="flag">
      <add_edit :editData="editData" @close_add_edit="close_add_edit"></add_edit>
    </div>

  </div>
</template>

<script>
  import add_edit from './add_edit'

  export default {
    components: {
      add_edit
    },
    data() {
      return {
        flag: false,
        editData:{}
      }
    },
    methods: {
      //打开对话框组件-目的：添加
      add() {
        this.flag=true
      },
      //打开对话框组件-目的：编辑
      edit() {
        let row={ id:1,name:'YK',age:'18'}
        this.editData=row
        this.flag=true
      },
      //关闭对话框组件
      close_add_edit(boolean_Value){
        this.editData={}
        this.flag=boolean_Value
      }
    }
  };
</script>

